package com.springboot.mybatis.example.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.springboot.mybatis.example.utils.RedisUtil;

/**
 * @Author: 
 * @Description:
 * @Date: Create in  2018/6/14 17:31
 */
@RestController
@RequestMapping(value = "/test")
public class TestRedisController {

    @Autowired
//    private RedisComponent redisComponet;
    private RedisUtil redisUtil;
    
    @GetMapping(value = "redisSet")
    public String testSetKey() {
    	
    	redisUtil.set("wang","Frank测试redis");
    	System.out.println(redisUtil.get("Frank"));
    	Object keyValue = redisUtil.get("Frank");
    	return keyValue.toString();
    }
    
	@RequestMapping("/redisDynSet/{key}")
	public String redisDynSet(@PathVariable String key) {
		redisUtil.set(key,key+"Frank测试redis");
    	System.out.println("key="+key+" value="+redisUtil.get(key));
    	Object keyValue = redisUtil.get(key);
    	return keyValue.toString();
	}
	

}
